def fei_b(n):
    if n <= 1:
        return n
    else:
        return fei_b(n - 1) + fei_b(n - 2)


x = int(input("请输入斐波那契的项数："))
c = 0
for i in range(x):
    print(fei_b(i), end=" ")
    c += 1
    if c % 5 == 0:
        c = 0
        print()
